<template>
  <div class="cont">
    <div class="cont-title">{{ contList.title }}</div>
    <div class="cont-time">发布时间：{{ utils.day(contList.pubtime) }}</div>
    <div class="cont-contents">{{ contList.content }}</div>
  </div>
</template>

<script lang="ts" setup>
import { onMounted, ref } from "vue";
import { useRoute } from "vue-router";
import { getOneInfos } from "@/server/active";
import utils from "@/utils/utils";

const route = useRoute();
const contList = ref<any>([]);
const id = ref()

onMounted(async () => {
  id.value = route.query.id
  await getOne()
});

function getOne(){
  getOneInfos(id.value).then((res:any) => {
    contList.value = res
  })
}
</script>

<style lang="less" scoped>
.cont {
  background-color: #eee;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 20px;
  &-title {
    font-size: 28px;
    font-weight: 600;
  }
  &-time {
    font-weight: 600;
    margin: 20px 0;
  }
}
</style>
